window.addEventListener('load', function () {
	var username = document.querySelector('.username')
	var psds = document.querySelector('.psds')
    var submit = document.getElementById("submit")
    var form1 = document.getElementById("form1")

	username.onfocus = function () {
		if (username.value == "邮箱/用户名/手机号") {
			username.value = ''
		}
	}
	username.onblur = function () {
		if (username.value == '') {
			username.value = "邮箱/用户名/手机号"
		}
	}

	psds.onfocus = function () {
		if (psds.value == "请输入密码") {
			psds.value = ''
		}
	}
	psds.onblur = function () {
		if (psds.value == '') {
			psds.value = "请输入密码"
		}
	}

	// 登录校验
	let count = 0
	submit.onclick = function(){
	    username = username.value
	    psds = psds.value
	    for (let i=0;i<obj.length;i++){
	        if(obj[i].username == username && obj[i].password == psds) {
	            count++
	        }
	    }
	    if(count){
	        form1.action = "index.html"
	    }else {
	        alert('用户名或密码错误')
	    }
	}



})

